<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>search|substring|charAt|split</title>

  <script>
    const str = "ab 12 hj 332 k67"

    let arr = []
    let temp = ''

    for (let i = 0; i < str.length; i++) {
      if (str[i].charAt() > '0' && str[i].charAt() < '9') {
        temp += str[i]
      } else {
        if (temp) {
          arr.push(temp)
          temp = ''
        }
      }
    }
    if (temp) {
      arr.push(temp)
      temp = ''
    }
    alert(arr)

    const reg = /\d+/g
    alert(reg.match(str))
  </script>
</head>
<body>
  
</body>
</html>